<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>星级评分</title>
    <style>
        * {
            margin: 0;
            padding: 0
        }

        div {
            line-height: 35px;
        }

        li {
            width: 24px;
            height: 24px;
            background: url(../img/star.png)no-repeat;
            float: left;
            list-style: none;
            margin: 5px;
            cursor: pointer;
            padding: 15px;
        }
    </style>
</head>

<body>
    <div>
        <ul>
            <li>
            </li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
        </ul>
        <span>

        </span>
    </div>
</body>
<script src="../作用域/wu.js"></script>
<script>
    var oldIndex = -1;
    var timer = null;
    $("li").mouseover(function () {
        var index = $(this).index();
        $("li").slice(0, index + 1).css("background-image", "url(../img/star_fill.png)");
        $("li").slice(index + 1).css("background-image", "url(../img/star.png)");
    }).mouseout(function () {
        $("li").slice(0, oldIndex + 1).css("background-image", "url(../img/star_fill.png)");
        $("li").slice(oldIndex + 1).css("background-image", "url(../img/star.png)");
    })
    $("li").click(function(){
        oldIndex=$(this).index()
    })


</script>

</html>